package cglib;

import net.sf.cglib.proxy.Enhancer;
import proxy.UserService;
import proxy.UserServiceImpl;


public class Main2 {
    public static void main(String[] args) {
    UserService userService = new UserServiceImpl();
    Enhancer exception = new Enhancer();
    exception.setSuperclass(userService.getClass());
    exception.setCallback(new CglibProxy());
    UserService userServiceProxy = (UserService)exception.create();
    System.out.println(userServiceProxy.getName(1));
    System.out.println(userServiceProxy.getAge(1));

    }


}
